package com.shuimutong.gmvc_ioc_demo;

import java.util.HashMap;
import java.util.Map;

import com.shuimutong.gmvc.bean.GmvcSystemConst;
import com.shuimutong.gmvc.mapper.InstanceManager;
import com.shuimutong.gmvc_ioc_demo.service.TestService;
import com.shuimutong.gmvc_ioc_demo.service.impl.TestServiceImpl;

/**
 * Hello world!
 *
 */
public class App {
    public static void main( String[] args ) {
    	Map<String, String> packageMap = new HashMap();
    	//扫描包目录
    	packageMap.put(GmvcSystemConst.BASE_PACKAGE, "com.shuimutong.gmvc_ioc_demo");
    	try {
			InstanceManager.initAnnotationedResourcesAndDoInit(packageMap);
		} catch (Exception e) {
			e.printStackTrace();
		}
    	//获取类的实例
    	TestService testService = (TestService) InstanceManager.getEntityByClazz(TestServiceImpl.class);
    	String msg = testService.convertString("Hello,GMVC-IOC");
    	System.out.println(msg);
    }
}
